<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromView;
use Illuminate\Contracts\View\View;
use App\Http\Models\Report\ReportRegionIndicator;

class ReportRegionIndicatorExport implements FromView
{
    public function view(): View
    {

        $year = is_numeric(request()->year) ? request()->year : date('Y', time());
        $month = is_numeric(request()->month) ? request()->month : date('m', time());

        $report_region_indicator = new ReportRegionIndicator($year, $month);

        return view('report.region_indicator_progress.table', [
            'year' => $year,
            'month' => $month,
            'report_region_indicator' => $report_region_indicator
        ]);
    }
}
